package com.photohistory.hibernate.beans;
// Generated 31.03.2010 12:15:52 by Hibernate Tools 3.2.4.GA


import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Category generated by hbm2java
 */
@Entity
@Table(name="category"
    ,catalog="mytest"
)
public class Category  implements java.io.Serializable {


     private Integer id;
     private Category category;
     private String name;
     private Set<Categoryhasspecialplaces> categoryhasspecialplaceses = new HashSet<Categoryhasspecialplaces>(0);
     private Set<Category> categories = new HashSet<Category>(0);
     private Set<Photohascategory> photohascategories = new HashSet<Photohascategory>(0);

    public Category() {
    }

	
    public Category(String name) {
        this.name = name;
    }
    public Category(Category category, String name, Set<Categoryhasspecialplaces> categoryhasspecialplaceses, Set<Category> categories, Set<Photohascategory> photohascategories) {
       this.category = category;
       this.name = name;
       this.categoryhasspecialplaceses = categoryhasspecialplaceses;
       this.categories = categories;
       this.photohascategories = photohascategories;
    }
   
     @Id @GeneratedValue(strategy=IDENTITY)

    
    @Column(name="id", unique=true, nullable=false)
    public Integer getId() {
        return this.id;
    }
    
    public void setId(Integer id) {
        this.id = id;
    }

@ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="parent_id")
    public Category getCategory() {
        return this.category;
    }
    
    public void setCategory(Category category) {
        this.category = category;
    }

    
    @Column(name="name", nullable=false, length=50)
    public String getName() {
        return this.name;
    }
    
    public void setName(String name) {
        this.name = name;
    }

@OneToMany(fetch=FetchType.LAZY, mappedBy="category")
    public Set<Categoryhasspecialplaces> getCategoryhasspecialplaceses() {
        return this.categoryhasspecialplaceses;
    }
    
    public void setCategoryhasspecialplaceses(Set<Categoryhasspecialplaces> categoryhasspecialplaceses) {
        this.categoryhasspecialplaceses = categoryhasspecialplaceses;
    }

@OneToMany(fetch=FetchType.LAZY, mappedBy="category")
    public Set<Category> getCategories() {
        return this.categories;
    }
    
    public void setCategories(Set<Category> categories) {
        this.categories = categories;
    }

@OneToMany(fetch=FetchType.LAZY, mappedBy="category")
    public Set<Photohascategory> getPhotohascategories() {
        return this.photohascategories;
    }
    
    public void setPhotohascategories(Set<Photohascategory> photohascategories) {
        this.photohascategories = photohascategories;
    }


    public String toString(){
    	return name;
    }


}


